<template>
	<view class="search-history">
		<view class="history-title">
			<text class="title-text">搜索历史</text>
			<uni-icons  type="trash-filled" size="25" @click="$emit('clear-history')"></uni-icons>
		</view>
		<view class="split-line"></view>
		<view class="history-box">
			<view class="history-item" v-for="(item,index) in kwList" :key="index" @click="histagHander(item)">
				<text v-text="item"></text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"my-search-history",
		data() {
			return {
				
			}
		},
		props:{
			kwList:{
				type:Array,
				required:true
			}
		},
		methods:{
			histagHander(item){
				this.$emit("kwlist-select",item);
				uni.navigateTo({
					url:`/subpkg/goods_list/goods_list?query=${item}`
				})
			}
		}
	}
</script>

<style lang="scss">
	.search-history{
		width: 100%;
		padding: 0 15rpx;
		box-sizing: border-box;
		.history-title{
			padding: 20rpx 0;
			display: flex;
			justify-content: space-between;
			align-items: center;
			.title-text{
				font-weight: bold;
				font-size: 35rpx;
			}
		}
		.split-line{
			height: 0;
			border-bottom: 1rpx gray solid;
		}
		.history-box{
			display: flex;
			flex-flow: row wrap;
			justify-content: flex-start;
			padding: 20rpx 0;
			border-radius: 3rpx;
			.history-item{
				background-color: #f5f5f5;
				height: 60rpx;
				font-size: 35rpx;
				padding: 0rpx 15rpx;
				margin: 10rpx 20rpx 10rpx 0rpx;
				display: flex;
				align-items: center;
			}
		}
	}
</style>
